package com.whitedust.top60;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author A
 * @since 2025/11/11 12:54
 */

public class Top60 {
    public List<List<Integer>> subsets(int[] nums) {
        List<Integer> path = new ArrayList<>();
        List<List<Integer>> res = new ArrayList<>();
        subsets2(nums, 0, path, res);
        return res;
    }

    private void subsets2(int[] nums, int start, List<Integer> path, List<List<Integer>> res) {
        res.add(new ArrayList<>(path));
        for (int i = start; i < nums.length; i++) {
            path.add(nums[i]);
            subsets2(nums, i+1, path, res);
            path.remove(path.size() - 1);
        }
    }
}
